

let yeshu = {pagenum: 1, pagesize: 6};
let total = 8;

let i=0
function loading () {
  
  $.ajax({
    
    url: 'http://localhost:8888/api/articles',
    data: yeshu,
    success: function (res) {
    console.log(res);
    let shu = res.data.length;
    i =i+1;
    shu1 =shu-i
    console.log(shu1);
      if(shu1>1){
        if(res.status ===0) {

      
          let str = '';
          res.data.forEach(item => {
            str+= `
            <div class="item">
                <h4>
                  <a href="./detail.html?id=${item.id}">${item.title}</a>
                </h4>
                <p class="meta">
                  <span>15分钟前 分享至</span>
                  <a href="javascript:;" class="wechat"></a>
                  <a href="javascript:;" class="weibo"></a>
                </p>
                <p class="brief">${item.content}</p>
              </div>
            `
          });
  
          $('.kr_news_list').append(str);
        }
      }
      else{
        layer.msg('没有数据了')
      }
     
      
    }
  })
  
}
loading();

$('.kr_more').on('click', function() {
 
  loading();
})